UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '39hRcJ4SWXtu3LYgd3Q0T83P9QKhhgPnMAYK2QS41gQ=' 
WHERE 
  key_id = '5c47d5fb5d1d0445f90ca10bd454ec7fa9cd93d10bb1b73e538be60b15de8762' 
  AND (
    token = '39hRcJ4SWXtu3LYgd3Q0T83P9QKhhgPnMAYK2QS41gQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046