UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hd7zZuIDzNlXXnEx4IOPMtCbBw/ri52CWc4iMZi9ikc=' 
WHERE 
  key_id = 'fed73675782f5bdd35c33bf0f4dec37e8e7c6151265ba4a942166232116e9225' 
  AND (
    token = 'hd7zZuIDzNlXXnEx4IOPMtCbBw/ri52CWc4iMZi9ikc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034