UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WyM/XwaNsyX3HaYLptCEGWHXlTQbHT9NnM3/YM+sIGI=' 
WHERE 
  key_id = '7145c017e4928418af930a877f58a1315997127932a804a0b50902e636bdc76b' 
  AND (
    token = 'WyM/XwaNsyX3HaYLptCEGWHXlTQbHT9NnM3/YM+sIGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058