UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0ir7JWA7Ia0qQvN91Y8vfKyFq49BJEEW3DxmVYkUKjk=' 
WHERE 
  key_id = '81f9080f1d1a537e525fed1534316bb078fa0a8740e1d00591ede02d681a6365' 
  AND (
    token = '0ir7JWA7Ia0qQvN91Y8vfKyFq49BJEEW3DxmVYkUKjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024