UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K2Z11Umcv/MrgrL9IX7C48/FYTbUOEvn5fqANfNP7Bg=' 
WHERE 
  key_id = '8bc8a276a596e97401c93f88a507e5d2f17ba235f1a0b764c492a611e508d961' 
  AND (
    token = 'K2Z11Umcv/MrgrL9IX7C48/FYTbUOEvn5fqANfNP7Bg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032