UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VZjQQ/7t1zT9BCCO89RHxxyRWeDibKA20xSgRw8CXWM=' 
WHERE 
  key_id = 'f4a46aa574d2b61ef2cd4b4fc169dc15e1867c267d9277a0523edbea24d6ccd0' 
  AND (
    token = 'VZjQQ/7t1zT9BCCO89RHxxyRWeDibKA20xSgRw8CXWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032