UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6nep/MEVCxT1Pcklsgc2FXQDVgbNjfugZUkXBX1KQbw=' 
WHERE 
  key_id = '31c031d6ffb62bae2a751024cec37904aec85da5602d71a2cf97a05867ca13e7' 
  AND (
    token = '6nep/MEVCxT1Pcklsgc2FXQDVgbNjfugZUkXBX1KQbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032