UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J/1Yeo693TPHFkmlgsIFp7HWZuP0aa2rwVtuycEpTRM=' 
WHERE 
  key_id = 'f967238fe3529de63a920d4a4d2839002fd815e1312e903418f8ce84833b805c' 
  AND (
    token = 'J/1Yeo693TPHFkmlgsIFp7HWZuP0aa2rwVtuycEpTRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059