UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nWtWft0Ts+48wJjgy6eOztEIoGDtYbesvcL+ev9HaD8=' 
WHERE 
  key_id = 'f3b4093a2657711b613d28d25af91b62062f1a1773b8ec7bb31caeb001928195' 
  AND (
    token = 'nWtWft0Ts+48wJjgy6eOztEIoGDtYbesvcL+ev9HaD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041