UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zShbL7YUpR8FRJD8+W/7pdHgQqlcnBEhF674F9rh02s=' 
WHERE 
  key_id = 'd7731e53a0443252bf707e32caa876437d1ee3d7aacd35350ce1b3f0cdd31809' 
  AND (
    token = 'zShbL7YUpR8FRJD8+W/7pdHgQqlcnBEhF674F9rh02s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023