UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'djgNdW4ULwpcuw9Rpc+AYd0DJH3d6B0QbT6MqEPvPeg=' 
WHERE 
  key_id = '18d9581a6b9561c15ab14ed7e32ac78ff053327a2cefb658d74ef51db2e863f6' 
  AND (
    token = 'djgNdW4ULwpcuw9Rpc+AYd0DJH3d6B0QbT6MqEPvPeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036