UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o3R6QwfCP0la7F98yYVuABEsAb++xYozElOVvuVbiTI=' 
WHERE 
  key_id = '3c0546ca422bb8699bd27197fe9dad411f0bdd66785827f98a4e0577b907716b' 
  AND (
    token = 'o3R6QwfCP0la7F98yYVuABEsAb++xYozElOVvuVbiTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022