UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XajQDCfLLb/NYaCVprVCd21VfA0M7uQJsvpkVJvDQ6w=' 
WHERE 
  key_id = '6702b9eeb47ba6cc903003a64b29cb3e4f62a8cdde9cd769d21d85c06311101c' 
  AND (
    token = 'XajQDCfLLb/NYaCVprVCd21VfA0M7uQJsvpkVJvDQ6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037