UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tgCWHTAvUPL9RIaXuKTHVIsDc06J8uAQjS0Qs9CgUH0=' 
WHERE 
  key_id = 'e5b7e66ed6632549c8d2624a60ad1f255cc5c476e914da8a0bbeed60c4b7cdbd' 
  AND (
    token = 'tgCWHTAvUPL9RIaXuKTHVIsDc06J8uAQjS0Qs9CgUH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026