UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5mrBc2ESbwtc5P6UO+pLVaC+fhPCIOpiOpilhSZXhXY=' 
WHERE 
  key_id = '4105f9d46832527fe0525bbb48a87fb33aa73ee03e6811b6f889176690ff157e' 
  AND (
    token = '5mrBc2ESbwtc5P6UO+pLVaC+fhPCIOpiOpilhSZXhXY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023