UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wBmpiiMWBTHEf14vfD825aM5U0lhW8AiyL+ZhNlXh28=' 
WHERE 
  key_id = '5b9834db7196385c12af0068ea14af1ab037f70bbae6792b56e5ce5f52ac0017' 
  AND (
    token = 'wBmpiiMWBTHEf14vfD825aM5U0lhW8AiyL+ZhNlXh28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023