UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IbtUOReSmq419qhSF6BrjDqXyHhA/Ol+r2Lry7/4ocs=' 
WHERE 
  key_id = '13a9d03d31a2ef0a70b381c6fd201b89b077521d2acd7ebb5e90ecee77b78750' 
  AND (
    token = 'IbtUOReSmq419qhSF6BrjDqXyHhA/Ol+r2Lry7/4ocs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033