UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYECRqiBQBsHuaIkorhyjco57cBKo7IMS9fcmNzGs2k=' 
WHERE 
  key_id = '3a408d30777cf512fb6f597dd7c92bb4f84e8560166fb35328b8d3bb5dc7d60f' 
  AND (
    token = 'DYECRqiBQBsHuaIkorhyjco57cBKo7IMS9fcmNzGs2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040