UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z00cATjh6iTQ6pljeUnM4iEdVv2kfgoTLkH+qgRQ7M0=' 
WHERE 
  key_id = '744f7cb0c781333872bf6d3c66407a8335c2e6738d489fb826cf9eaaee9b869b' 
  AND (
    token = 'Z00cATjh6iTQ6pljeUnM4iEdVv2kfgoTLkH+qgRQ7M0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047