UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'byeiw/duSkYUikeR/W+j9NIEsWv0QPcsdSpkqNftm3g=' 
WHERE 
  key_id = '762f42d7353a6943356c7b384224445369cf62a3b254df39f2daeab3f7abc174' 
  AND (
    token = 'byeiw/duSkYUikeR/W+j9NIEsWv0QPcsdSpkqNftm3g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043