UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x57gvUzBW/Z7hMY5YZJkwmV41l7CfYw5+7Eti+vjKAs=' 
WHERE 
  key_id = '276bc580a966bc42a8d2bfccfbce04e854d7e3eb5adedfc9fb0037032b12f7b7' 
  AND (
    token = 'x57gvUzBW/Z7hMY5YZJkwmV41l7CfYw5+7Eti+vjKAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023