UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BLt9mRAXlI5mONYgV/3fHR4DwK2/6uvIlvX7SZ6yj0A=' 
WHERE 
  key_id = '78154e73fa6adab3671547f1ab3f0c94adcfb3c45dd7f3cbb2127f229e23ed38' 
  AND (
    token = 'BLt9mRAXlI5mONYgV/3fHR4DwK2/6uvIlvX7SZ6yj0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032