UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XmymV45o6xBsehFGINoSBosTj0GHPLmlHvmDQh7pgSY=' 
WHERE 
  key_id = '27d7c020a979d00c914c6fa20eccc0dbc48542e0572d33f57711262a1a8df6a7' 
  AND (
    token = 'XmymV45o6xBsehFGINoSBosTj0GHPLmlHvmDQh7pgSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021