UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Z6iX7wUM2yhfpmU0bDJWLmfm29WTNDW31bMJYhR098=' 
WHERE 
  key_id = '4af9f31ecfa905bb5c34fdb37da66b34de9d9ee84eebd0290fc540be11d98471' 
  AND (
    token = '+Z6iX7wUM2yhfpmU0bDJWLmfm29WTNDW31bMJYhR098=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036