UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'htZR8yKv0IQnxPv0sOJ8mLaWepfYWRWys9azH2+TxVo=' 
WHERE 
  key_id = '1e04de659550e060f69065705410284681e18adec0de7bbc029016cd27345c36' 
  AND (
    token = 'htZR8yKv0IQnxPv0sOJ8mLaWepfYWRWys9azH2+TxVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040