UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JnMBV3h4ses4YpOuyfAblVCcUst7YYkX5vfCQ73cnzw=' 
WHERE 
  key_id = '256fd0d11c01247da065000ba254040986c7a7dfc16283ae1bdef7caaa117892' 
  AND (
    token = 'JnMBV3h4ses4YpOuyfAblVCcUst7YYkX5vfCQ73cnzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038