UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DzScLRiW+nsKN+tV5OmEZatqyD48yvPl3wVbacf4kcE=' 
WHERE 
  key_id = '12b9d76173a22fca7b5ab44ecb775a0a2d7f12a0b34a8a4d1da5aa5d5f506982' 
  AND (
    token = 'DzScLRiW+nsKN+tV5OmEZatqyD48yvPl3wVbacf4kcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030