UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lXLukKuvpKvD0j2c3+pTpV7lbTMzvPvTL/QQsYY5IPM=' 
WHERE 
  key_id = '582515b1cf73f6b9c3109e2f3890f8f377cd9a66837bd2aa7b8519c984a4984b' 
  AND (
    token = 'lXLukKuvpKvD0j2c3+pTpV7lbTMzvPvTL/QQsYY5IPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032