UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o/vx+SeJ0d/TzI+LS2ZL+qVlGka2ZHKsry+HHVud7mU=' 
WHERE 
  key_id = '7eab9741e885a0646124e10e5e2da169a32e38450df51805e950539fe892ad27' 
  AND (
    token = 'o/vx+SeJ0d/TzI+LS2ZL+qVlGka2ZHKsry+HHVud7mU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024