UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r7nO33/R/TK1TNmZXmHpUS2G2xzq4bEp93cea//i6Ro=' 
WHERE 
  key_id = '8daaf14192c4333df777343c44b64d235d605b0532822609c0b5595159e375c5' 
  AND (
    token = 'r7nO33/R/TK1TNmZXmHpUS2G2xzq4bEp93cea//i6Ro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035