UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XNAU6Qtt/GO2HmlNmiI2Nivl1WflXTjSzrQ3ArqHUGY=' 
WHERE 
  key_id = '5dbc7472184fe387b5be4bb6785ce7467e5b5cba24b0624bebdb22d1226601ee' 
  AND (
    token = 'XNAU6Qtt/GO2HmlNmiI2Nivl1WflXTjSzrQ3ArqHUGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046