UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T3UVPuSMitqhBXMJwoPvCcvJDp2XuE9d2z0YV+/2yCI=' 
WHERE 
  key_id = 'bdc323bf6ba6ad05e8fdce90cc0fc5cbe8c048269b540ee3d3e7769cfc360833' 
  AND (
    token = 'T3UVPuSMitqhBXMJwoPvCcvJDp2XuE9d2z0YV+/2yCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035