UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gIMc6pFGyps+HrHvw9Mch9drXdnkuVnwe2cQyWh+fAM=' 
WHERE 
  key_id = 'bf77905482f828cc8dd9a25178a49b683880c67f93a5f58c63845458279645c5' 
  AND (
    token = 'gIMc6pFGyps+HrHvw9Mch9drXdnkuVnwe2cQyWh+fAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023