UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VcQwt6zpwy8OSjCVPqjSlVlwRYCu1OB8c2f5LIVI8iY=' 
WHERE 
  key_id = '323c91e2e68e6e27816ee8a3347e8bb9cba1dd2e2e0fa16e048f066d3b977cff' 
  AND (
    token = 'VcQwt6zpwy8OSjCVPqjSlVlwRYCu1OB8c2f5LIVI8iY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024