UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'alhBRTNXl4R1BwcQQc3JWCMWEh+A35e5j43O+59o73o=' 
WHERE 
  key_id = 'eaf6d35ba67b8482aa4142967095454dc926ab6df2615910d24d7aaf5f5dd8de' 
  AND (
    token = 'alhBRTNXl4R1BwcQQc3JWCMWEh+A35e5j43O+59o73o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031