UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qhH2VH23f1C2jpCBhmBSZxss1bdARthCZWpPn8fc+HA=' 
WHERE 
  key_id = '4ee98cd09afe34f27dcb406ee33d06c2861e273148a310f6bb200fff631d1313' 
  AND (
    token = 'qhH2VH23f1C2jpCBhmBSZxss1bdARthCZWpPn8fc+HA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029