UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YlYKXjqRQD5stGAOWcZ76qR4UTcQgfo8CqKUDdy9QTM=' 
WHERE 
  key_id = '57162ac5099381fa0a84779c76c4c5d2169ca9a51910bb357d3b28f97f4ed918' 
  AND (
    token = 'YlYKXjqRQD5stGAOWcZ76qR4UTcQgfo8CqKUDdy9QTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032