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

Query time 0.00047