UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+d0bORpooGplm67jI2uuMOF866iR+cqBETE1DFB+DgA=' 
WHERE 
  key_id = '5b96239e82c27fa6ee6a96678c52f86497cb11489018bcf55837373ed2470312' 
  AND (
    token = '+d0bORpooGplm67jI2uuMOF866iR+cqBETE1DFB+DgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018