UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eM8aLv90KpH6obnW5+gnGDZFibuuvQaKuYn7F2uuLoE=' 
WHERE 
  key_id = 'a7075ef04bea9b6c62f48c47842e0c784d8c32804601325e98e96e48220feb6c' 
  AND (
    token = 'eM8aLv90KpH6obnW5+gnGDZFibuuvQaKuYn7F2uuLoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034