UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OriBSjE8O97DPAA4yUPirweh1XgXIWOCMPcqEQOx0zs=' 
WHERE 
  key_id = 'a6b7daf3aa4dfb1c2e14279d128248043b64802039677027d928daad50a0f92f' 
  AND (
    token = 'OriBSjE8O97DPAA4yUPirweh1XgXIWOCMPcqEQOx0zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029