UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3fArTu36NPuJy1s+V1eC5s6h8FDtJCEiBc/riYA2eFU=' 
WHERE 
  key_id = 'c27e2f9fd81601b5d2c60eb4dda4bac2568c62b1f0543b5d546df9ec712c4373' 
  AND (
    token = '3fArTu36NPuJy1s+V1eC5s6h8FDtJCEiBc/riYA2eFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032