UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZRhE61I9lIMXS7BNEzkx4MYFptpJVBkDHreZj0EsXiY=' 
WHERE 
  key_id = '1098771cbe77d745bb9616f9b05744c47a47858785b5f1aebdcfb6cac6783366' 
  AND (
    token = 'ZRhE61I9lIMXS7BNEzkx4MYFptpJVBkDHreZj0EsXiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040