UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R+k/QfDcrqdV2992Nto7h4wcGCfBarWZO73TOR8bEr0=' 
WHERE 
  key_id = 'f9dd674ad86b213aa1abe52edd8b8fe9cc6a8da619d93e71964629ebd6745fb6' 
  AND (
    token = 'R+k/QfDcrqdV2992Nto7h4wcGCfBarWZO73TOR8bEr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016