UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sNtuJohXMZOSEwYw1+YbzbFmMkaybbWTOXFTRHKCBII=' 
WHERE 
  key_id = '9b3bb3949f23fbf4fc2f9640957fc88b75b7d7aa83f0203fe723eab5c6c6eac9' 
  AND (
    token = 'sNtuJohXMZOSEwYw1+YbzbFmMkaybbWTOXFTRHKCBII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022