UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HqgqWSRaEK3uP+sd23JaF1tDQ41XFUrK1UOUORUtAuI=' 
WHERE 
  key_id = 'fd3ec3385f50eca18ff8f56e1fd6d12159b4997bd963e5f96aad426b236045d9' 
  AND (
    token = 'HqgqWSRaEK3uP+sd23JaF1tDQ41XFUrK1UOUORUtAuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038